home *** CD-ROM | disk | FTP | other *** search
- Path: news.clark.net!not-for-mail
- From: gusty@clark.net (Harlan Messinger)
- Newsgroups: comp.lang.c++
- Subject: Re: void pointers
- Date: 5 Jan 1996 22:27:44 GMT
- Organization: Clark Internet Services, Inc., Ellicott City, MD USA
- Message-ID: <4ck8l0$3ec@clarknet.clark.net>
- References: <Pine.SUN.3.91.960105113409.18158A-100000@phoenix.acms.arizona.edu>
- NNTP-Posting-Host: explorer.clark.net
- Mime-Version: 1.0
- Content-Type: TEXT/PLAIN; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- X-Newsreader: TIN [UNIX 1.3 950726BETA PL0]
-
- Kenton White (jwhite@phoenix.acms.arizona.edu) wrote:
- :
- :
- : I am trying to create a class that stores pointers to other classes in an
- : array of void pointers. Since void pointers cannot be dereferenced, is
- : there any way to cast the void pointer to a non-void pointer and then
- : dereference?
- :
-
- Absolutely, as long as you know at the point in the code where the
- dereferencing is to take place what type of pointer it should be.
-
- If the different classes have a common base class, or SHOULD have a
- common base class, then it's better to have an array of pointers to the
- base class and a set of virtual functions.
-